From 1a29dfb65977e476a32aa3960135889c55135e89 Mon Sep 17 00:00:00 2001 From: robertl Date: Mon, 17 Oct 2005 18:09:06 +0000 Subject: [PATCH] Move fatal and warning to a file of their own. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@1471 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/Makefile | 2 +- gpsbabel/fatal.c | 41 +++++++++++++++++++++++++++++++++++++++++ gpsbabel/util.c | 21 +-------------------- 3 files changed, 43 insertions(+), 21 deletions(-) create mode 100644 gpsbabel/fatal.c diff --git a/gpsbabel/Makefile b/gpsbabel/Makefile index 6c5f13879..d42cf534a 100644 --- a/gpsbabel/Makefile +++ b/gpsbabel/Makefile @@ -59,7 +59,7 @@ SHAPE=shapelib/shpopen.o shapelib/dbfopen.o LIBOBJS = queue.o route.o waypt.o filter_vecs.o util.o vecs.o mkshort.o \ csv_util.o strptime.o grtcirc.o vmem.o util_crc.o xmlgeneric.o \ - uuid.o formspec.o xmltag.o cet.o cet_util.o \ + uuid.o formspec.o xmltag.o cet.o cet_util.o fatal.o \ $(COLDSYNC) $(GARMIN) $(JEEPS) $(SHAPE) $(FMTS) $(FILTERS) OBJS = main.o globals.o $(LIBOBJS) diff --git a/gpsbabel/fatal.c b/gpsbabel/fatal.c new file mode 100644 index 000000000..30275f474 --- /dev/null +++ b/gpsbabel/fatal.c @@ -0,0 +1,41 @@ +/* + Functions to indicate inconsistent or fatal conditions. + + Copyright (C) 2002-2005 Robert Lipe, robertlipe@usa.net + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA + + */ + +#include "defs.h" +void +fatal(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + exit(1); +} + +void +warning(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} + diff --git a/gpsbabel/util.c b/gpsbabel/util.c index 4dd1da8ea..fa0438584 100644 --- a/gpsbabel/util.c +++ b/gpsbabel/util.c @@ -1,7 +1,7 @@ /* Misc utilities. - Copyright (C) 2002 Robert Lipe, robertlipe@usa.net + Copyright (C) 2002-2005 Robert Lipe, robertlipe@usa.net This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -369,16 +369,6 @@ printposn(const double c, int is_lat) printf("%f%c ", fabs(c), d); } -void -fatal(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - exit(1); -} - void is_fatal(const int condition, const char *fmt, ...) { @@ -394,15 +384,6 @@ is_fatal(const int condition, const char *fmt, ...) fatal("%s\n", buff); } -void -warning(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); -} - /* * Read 4 bytes in big-endian. Return as "int" in native endianness. */ -- 2.30.2